package com.combat.text.user.controller;


import com.combat.text.user.entity.root;
import com.combat.text.user.entity.user;
import com.combat.text.user.entity.userroot;
import com.combat.text.user.service.DeptService;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.DeleteProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author KangJx
 * @date 2020/12/15
 */
@RestController
@RequestMapping("/api")
public class DeptController {

    @Autowired
    DeptService deptService;

    @ApiOperation("水阻显示")
    @GetMapping("/water/show")
    public  List<Map<String,Object>> watershow(){
       return deptService.watershow();
    }
    @PostMapping ("/user/login/{uno}/{upassword}")
    public Map<String,Object> login(@PathVariable int uno , @PathVariable int upassword){
        return deptService.login(uno,upassword);
    }
    @ApiOperation("人员管理")
    @GetMapping("/user/show")
    public Map<String ,Object> show(int limit,int page,String search){
        return deptService.selectshow(limit,page,search);
    }

    @ApiOperation("人员修改增加")
    @PostMapping("/user/addupdata")
    public int save(user u){
        return deptService.save(u);
    }

    @ApiOperation("人员删除")
    @DeleteMapping("/user/deluser")
    public int del(int uno){
        return deptService.deluser(uno);
    }

    @GetMapping("/user/showroot")
    public List<root> showroot(){
        return deptService.showroot();
    }

    @GetMapping("/user/showrroot")
    public List<userroot> showrroot(){
        return deptService.showrroot();
    }
}
